package com.cw.base.jeeyc.qlexpress;

import com.cw.lang.common.utils.GsonUtil;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;

import lombok.extern.slf4j.Slf4j;

/**
 *
 * @author chenw
 * @date 2020/12/18
 */
@Slf4j
public class QlexpressController {

    public static void testQlexpress() throws Exception {
        ExpressRunner expressRunner = new ExpressRunner();
        DefaultContext<String,Object> context = new DefaultContext<>();
        context.put("a",1);
        context.put("b",2);
        context.put("c",3);
        Object result = expressRunner.execute("a+b*c",context,null,true,false);
        log.info(GsonUtil.objectToJsonString(result));
    }

    public static void main(String[] args) throws Exception {
        testQlexpress();
    }
}
